<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="main" style="height: 400px"></div>
    <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.1/dist/echarts.min.js"></script>

    <script>
      window.onload = function () {
        const myChart = echarts.init(document.getElementById('main'))
        const option = {
          backgroundColor: 'rgba(255, 0, 0, 0.1)',
          grid: {
            show: true,
            backgroundColor: 'rgba(0, 255, 0, 0.1)'
          },
          xAxis: {
            data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
          },
          yAxis: {},
          series: [
            {
              name: '产品销量柱形图',
              type: 'bar',
              // 系列图形上的文本标签
              label: {
                show: true,
                position: [10, 10], // 支持的类型可以查文档，不同type的position的值会有些差异
                color: 'red',
                fontSize: 20
              },
              data: [5, 20, 36, 10, 10, 20]
            }
          ]
        }
        myChart.setOption(option)
      }
    </script>
  </body>
</html>
